-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: enable feature tagging #2395
Conversation
quic/s2n-quic/Cargo.toml
Outdated
# Compile with the `s2n_docsrs` feature to enable feature tagging in rust docs. See | ||
# documentation for additional configuration options: https://docs.rs/about/metadata | ||
[package.metadata.docs.rs] | ||
rustdoc-args = ["--cfg", "s2n_docsrs"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we need our own? Why not just use the one docs.rs already sets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I wasn't sure if that was something that docsrs set or if tokio didnt namespace the cfg flag. Lemme try and find docs mentioning that and/or test it on my test crate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So actually are you certain that gets set by docsrs? Tokio also sets rustdoc-args which specifies docsrs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks for doing this :)
Resolved issues:
#1831
Description of changes:
This PR enables feature tagging in our rust docs. This is useful for customers that want to use enable APIs that require building s2n-quic with certain features.
Call-outs:
This PR only covers the main s2n-quic crate. Future work might be to expand feature tagging to other s2n-quic crates.
We need to gate the feature on
docsrs
since it requires nightly cargo and would otherwise break stable builds.We rely
doc_auto_cfg
to auto generate the feature tagging where applicable. However, we also require manually tagging withdoc_cfg
cfg_if!
macroTesting:
The example report in CI shows the feature tagging.
I also tested this on a personal test crate to verify crates.io works as intended.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.